<?php
/**
 * 简单的调用者
 * Class Controller
 */
class Controller{
	private $context;

	function __construct(){
		$this->context = new CommandContext();
	}

	function getContext(){
		return $this->context;
	}

	function process(){
		$cmd = CommandFactory::getCommand($this->context->get('action'));
		if(! $cmd->execute($this->context)){
			echo $this->context->get('action').' 处理失败'."\n<BR/>";
		}else{
			echo $this->context->get('action').' 处理成功'."\n<BR/>";
		}
	}
	
}